-
-
Notifications
You must be signed in to change notification settings - Fork 302
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
extend lastcmd mode to support all the previous cmds #1831
Conversation
aeb9b1d
to
7a9f8cf
Compare
I feel "rolling over" to the previous/next command is not exactly idea:
Left and Right are not used in lastcmd mode, what about using them to navigate commands? |
@xiaq How about using |
Alt-Up/Down sound fine too! |
Signed-off-by: Tw <[email protected]>
7a9f8cf
to
6300987
Compare
Updated in the latest version. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm going to merge this to a separate branch before integrating into master
.
I'll probably only work on the integration next week, so feel free to open more pull requests in the interim (or not, whichever you prefer :).
for i, word := range words { | ||
entries[i+1] = lastcmdEntry{strconv.Itoa(i), strconv.Itoa(i - len(words)), word} | ||
|
||
get_items := func(c histutil.Cursor) []lastcmdEntry { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Should be called getItems
- also the choice of making c
an argument seems arbitrary, it's always the same argument
// A function called when selecting before the beginning of the items. | ||
OnUnderFlow func(ListBox) | ||
// A function called when selecting after the ending of the items. | ||
OnOverFlow func(ListBox) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
These are misnomers that they're no longer triggered when underflow/overflow. Maybe OnPrevItemSet
would be a bit better.
case term.K(ui.Up, ui.Alt): | ||
w.OnUnderFlow(w) | ||
return true | ||
case term.K(ui.Down, ui.Alt): | ||
w.OnOverFlow(w) | ||
return true |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It would be nicer if this is part of the keybinding rather than hardcoded in the event handler.
Sometimes, I found that what I want is not just last command, but even older one.